package com.sdx.console.meetProduct.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.meetProduct.dao.MeetProductDao;
import com.sdx.console.meetProduct.entity.MeetProduct;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 一对一服务 Service
 */

@Service
@Transactional
public class MeetProductService extends BaseService<MeetProduct>{

    @Resource
	private MeetProductDao meetProductDao;

    public PageQuery<MeetProduct>queryByCondition(PageQuery query){
        PageQuery ret =  meetProductDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelMeetProduct(List<String> ids){
        try {
            meetProductDao.batchDelMeetProductByIds(ids);

            meetProductDao.delMeetCust(ids);

        } catch (Exception e) {
            throw new PlatformException("批量删除一对一服务失败", e);
        }
    }

    public List<String> queryCustByProductId(Integer productId){
        return meetProductDao.queryCustByProductId(productId);
    }

	public List<MeetProduct> all() {
		return meetProductDao.all();
		}

    public void delMeetCust(List<String> ids) {
        meetProductDao.delMeetCust(ids);
    }
}
